#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

#define EXE "child.out"

int create_process(char* path, char* argv[], char* env[])
{
    int ret = fork();
    if (ret == 0) {
        execve(path, argv, env);
    }

    return ret;
}

int main(int argc, char* argv[])
{
    char path[] = EXE;
    char arg1[] = "hello";
    char arg2[] = "world";
    char* args[] = {path, arg1, arg2, NULL};

    printf("pid = %d begin\n", getpid());
    printf("pid = %d, child pid = %d\n", getpid(), create_process(EXE, args, args));
    printf("pid = %d end\n", getpid());

    return 0;
}
